package collection;

import javax.swing.*;
import java.sql.ClientInfoStatus;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 将集合元素转换类型
 */
public class StreamAPIDemo5 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for(int i = 0;i<10;i++){
            list.add(i);
        }
        System.out.println(list);
        List<Double> list2 = list.stream()
                             .mapToDouble(e->e/2).boxed()
                //原流是Integer，mapToDouble后边需要用boxed(),包装成Double
                             .collect(Collectors.toList());
    }

}
